home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form Form1
- Caption = "UCALC Fast Math Parser 1.0"
- ClientHeight = 5280
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 7785
- LinkTopic = "Form1"
- ScaleHeight = 5280
- ScaleWidth = 7785
- StartUpPosition = 3 'Windows Default
- Begin VB.CommandButton Command1
- Caption = "Start"
- Height = 375
- Left = 3840
- TabIndex = 34
- Top = 4440
- Width = 495
- End
- Begin VB.TextBox Text10
- Height = 285
- Left = 5760
- TabIndex = 31
- Top = 4920
- Width = 1935
- End
- Begin VB.TextBox Text8
- Height = 285
- Left = 5760
- TabIndex = 30
- Text = "x^2+5x-10"
- Top = 4560
- Width = 1935
- End
- Begin VB.TextBox Text9
- Height = 285
- Left = 2880
- TabIndex = 28
- Text = "1000"
- Top = 4920
- Width = 855
- End
- Begin VB.TextBox Text7
- Height = 285
- Left = 3840
- TabIndex = 20
- Text = "-sin(x)/2"
- Top = 480
- Width = 3015
- End
- Begin VB.TextBox Text6
- Height = 285
- Left = 720
- TabIndex = 19
- Text = "(result)"
- Top = 4200
- Width = 2895
- End
- Begin VB.CommandButton btnPlot
- Caption = "Plot"
- Height = 375
- Left = 6960
- TabIndex = 13
- Top = 480
- Width = 615
- End
- Begin VB.PictureBox Picture1
- Height = 1215
- Left = 3840
- ScaleHeight = 1155
- ScaleWidth = 2955
- TabIndex = 12
- Top = 840
- Width = 3015
- End
- Begin VB.CommandButton btnCalc
- Caption = "Calculate"
- Height = 375
- Left = 3720
- TabIndex = 9
- Top = 3720
- Width = 1335
- End
- Begin VB.TextBox Text5
- Height = 285
- Left = 720
- TabIndex = 8
- Text = "test*area(3.5,10)+1234"
- Top = 3720
- Width = 2895
- End
- Begin VB.CommandButton btnFunction
- Caption = "Define Function"
- Height = 375
- Left = 3720
- TabIndex = 7
- Top = 3240
- Width = 1335
- End
- Begin VB.CommandButton btnVariable
- Caption = "Define Variable"
- Height = 375
- Left = 3720
- TabIndex = 6
- Top = 2760
- Width = 1335
- End
- Begin VB.TextBox Text4
- Height = 285
- Left = 720
- TabIndex = 5
- Text = "area(length,width)=length*width"
- Top = 3240
- Width = 2895
- End
- Begin VB.TextBox Text3
- Height = 285
- Left = 720
- TabIndex = 4
- Text = "test=100"
- Top = 2760
- Width = 2895
- End
- Begin VB.CommandButton btnEval
- Caption = "Calculate"
- Height = 375
- Left = 120
- TabIndex = 3
- Top = 1320
- Width = 1095
- End
- Begin VB.TextBox Text2
- Height = 285
- Left = 720
- TabIndex = 1
- Text = "(result)"
- ToolTipText = "Text2 = ucEval(Text1)"
- Top = 840
- Width = 2655
- End
- Begin VB.TextBox Text1
- Height = 285
- Left = 720
- TabIndex = 0
- Text = "3+4/5-8"
- Top = 480
- Width = 2655
- End
- Begin VB.Label Label16
- Alignment = 2 'Center
- BackColor = &H00FFFFC0&
- BorderStyle = 1 'Fixed Single
- Caption = "Speed Test"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 120
- TabIndex = 35
- Top = 4800
- Width = 1695
- End
- Begin VB.Label Label19
- Caption = "Elapsed (sec) / Answer:"
- Height = 255
- Left = 3960
- TabIndex = 33
- Top = 4920
- Width = 1695
- End
- Begin VB.Label Label18
- Caption = "User Expression:"
- Height = 255
- Left = 4440
- TabIndex = 32
- Top = 4560
- Width = 1215
- End
- Begin VB.Line Line17
- BorderWidth = 2
- X1 = 120
- X2 = 3720
- Y1 = 4680
- Y2 = 4680
- End
- Begin VB.Label Label17
- Caption = "Summation from 1 to:"
- Height = 375
- Left = 2040
- TabIndex = 29
- Top = 4800
- Width = 855
- End
- Begin VB.Line Line16
- BorderWidth = 2
- X1 = 3720
- X2 = 3720
- Y1 = 4680
- Y2 = 4320
- End
- Begin VB.Line Line14
- BorderWidth = 2
- X1 = 3720
- X2 = 7680
- Y1 = 4320
- Y2 = 4320
- End
- Begin VB.Label Label15
- Caption = "Text6:"
- Height = 255
- Left = 120
- TabIndex = 27
- Top = 4200
- Width = 495
- End
- Begin VB.Label Label14
- Caption = "Text5:"
- Height = 255
- Left = 120
- TabIndex = 26
- Top = 3720
- Width = 495
- End
- Begin VB.Label Label13
- Caption = "Text4:"
- Height = 255
- Left = 120
- TabIndex = 25
- Top = 3240
- Width = 495
- End
- Begin VB.Label Label12
- Caption = "Text3:"
- Height = 255
- Left = 120
- TabIndex = 24
- Top = 2760
- Width = 495
- End
- Begin VB.Line Line13
- X1 = 5280
- X2 = 5640
- Y1 = 3960
- Y2 = 3960
- End
- Begin VB.Line Line12
- X1 = 5640
- X2 = 5520
- Y1 = 3960
- Y2 = 3840
- End
- Begin VB.Line Line11
- X1 = 5640
- X2 = 5520
- Y1 = 3960
- Y2 = 4080
- End
- Begin VB.Line Line10
- X1 = 5280
- X2 = 5640
- Y1 = 3480
- Y2 = 3480
- End
- Begin VB.Line Line9
- X1 = 5640
- X2 = 5520
- Y1 = 3480
- Y2 = 3360
- End
- Begin VB.Line Line8
- X1 = 5640
- X2 = 5520
- Y1 = 3480
- Y2 = 3600
- End
- Begin VB.Line Line7
- X1 = 5280
- X2 = 5640
- Y1 = 3000
- Y2 = 3000
- End
- Begin VB.Line Line6
- X1 = 5640
- X2 = 5520
- Y1 = 3000
- Y2 = 2880
- End
- Begin VB.Line Line5
- X1 = 5640
- X2 = 5520
- Y1 = 3000
- Y2 = 3120
- End
- Begin VB.Label Label11
- Caption = "Text6 = ucEval(Text5)"
- Height = 255
- Left = 5880
- TabIndex = 23
- Top = 3840
- Width = 1695
- End
- Begin VB.Label Label10
- Caption = "Source Code:"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 5880
- TabIndex = 22
- Top = 2400
- Width = 1575
- End
- Begin VB.Label Label3
- Caption = "Source Code:"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 1680
- TabIndex = 21
- Top = 1440
- Width = 1575
- End
- Begin VB.Line Line15
- BorderWidth = 2
- X1 = 7680
- X2 = 120
- Y1 = 2280
- Y2 = 2280
- End
- Begin VB.Line Line1
- BorderWidth = 2
- X1 = 3600
- X2 = 3600
- Y1 = 120
- Y2 = 2280
- End
- Begin VB.Line Line4
- X1 = 1560
- X2 = 1440
- Y1 = 1560
- Y2 = 1680
- End
- Begin VB.Line Line3
- X1 = 1560
- X2 = 1440
- Y1 = 1560
- Y2 = 1440
- End
- Begin VB.Line Line2
- X1 = 1320
- X2 = 1560
- Y1 = 1560
- Y2 = 1560
- End
- Begin VB.Label Label9
- Caption = "ucDefineFunction Tex4"
- Height = 255
- Left = 5880
- TabIndex = 18
- Top = 3360
- Width = 1695
- End
- Begin VB.Label Label8
- Caption = "ucDefineVariable Text3"
- Height = 255
- Left = 5880
- TabIndex = 17
- Top = 2880
- Width = 1695
- End
- Begin VB.Label Label7
- Caption = "Text2:"
- Height = 255
- Left = 120
- TabIndex = 16
- Top = 840
- Width = 495
- End
- Begin VB.Label Label6
- Caption = "Text1:"
- Height = 255
- Left = 120
- TabIndex = 15
- Top = 480
- Width = 615
- End
- Begin VB.Label Label5
- Caption = "Text2 = ucEval(Text1)"
- Height = 255
- Left = 1680
- TabIndex = 14
- Top = 1680
- Width = 1695
- End
- Begin VB.Label Label4
- Caption = "Example usng ucEvaluate() in a time-critical loop"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 3840
- TabIndex = 11
- Top = 120
- Width = 3495
- End
- Begin VB.Label Label2
- Caption = "Example with a user-defined variable and function"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 720
- TabIndex = 10
- Top = 2400
- Width = 3735
- End
- Begin VB.Label Label1
- Caption = "Example using ucEval() for simplicity"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 720
- TabIndex = 2
- Top = 120
- Width = 2655
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub Form_Load()
- ucalcNull = ucEval("Display opening messages")
- End Sub
- ' Demonstrates the use of ucEval()
- ' Your program should include an error handler
- Private Sub btnEval_Click()
- On Error GoTo ErrorHandler
- Text2 = ucEval(Text1)
- If ucError = 0 Then Exit Sub
- ErrorHandler:
- If Err Then MsgBox Error$, vbExclamation
- If ucError Then MsgBox ucErrorMessage, vbExclamation
- End Sub
- ' Demonstrates the fast ucEvaluate() function
- Private Sub btnPlot_Click()
- Dim x As Double, UserEq As Long, VariableX As Long
- On Error Resume Next
- Picture1.Cls
- Picture1.Scale (-10, 2)-(10, -2)
- Picture1.PSet (-10, 0)
- VariableX = ucDefineVariable("x")
- UserEq = ucParse(Text7)
- For x = -10 To 10 Step 0.5
- ucVariableValue(VariableX) = x
- Picture1.Line -(x, ucEvaluate(UserEq))
- Next
- ucReleaseExpr
- End Sub
- ' Defines a function at runtime
- Private Sub btnFunction_Click()
- ' On Error Goto ...
- ucDefineFunction Text4
- End Sub
- ' Defines a variable at runtime
- Private Sub btnVariable_Click()
- ' On Error GoTo ...
- ucDefineVariable Text3
- End Sub
- ' Example using the one-step ucEval() function
- ' Your program should include an error handler
- Private Sub btnCalc_Click()
- On Error GoTo ErrorHandler
- Text6 = ucEval(Text5)
- If ucError = 0 Then Exit Sub
- ErrorHandler:
- If Err Then MsgBox Error$, vbExclamation
- If ucError Then MsgBox ucErrorMessage, vbExclamation
- End Sub
- Private Sub Command1_Click()
- Dim x As Double, UserEq As Long, VarX As Integer
- Dim Sum As Double, TimerStart As Single, Elapsed As Single
- Text10 = ""
- Text10.Refresh
- TimerStart = Timer
- VarX = ucDefineVariable("x")
- UserEq = ucParse(Text8)
- For x = 1 To Text9
- ucVariableValue(VarX) = x
- Sum = Sum + ucEvaluate(UserEq)
- Next
- Elapsed = Timer - TimerStart
- Text10 = Int(Elapsed * 100) / 100 & " / " & Sum
- ucReleaseExpr
- End Sub
-